<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('系统 - 任务主体列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>任务名称：</p>
                                <input type="text" name="title"/>
                            </li>
                           <!-- <li>
                                <p>内容：</p>
                                <input type="text" name="content"/>
                            </li>-->
                           <!-- <li class="select-time">
                                <p>完成时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginFinishTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endFinishTime]"/>
                            </li>-->
                            <li class="select-time">
                                <p>添加时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginAddtime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endAddtime]"/>
                            </li>
                          <!--  <li>
                                <p>完成率：</p>
                                <input type="text" name="finishRate"/>
                            </li>
                            <li>
                                <p>0未发布，1已发布：</p>
                                <select name="isPublish" th:with="type=${@dict.getType('')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <p>发布时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPublishTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPublishTime]"/>
                            </li>
                            <li>
                                <p>发布人ID：</p>
                                <input type="text" name="addId"/>
                            </li>
                            <li>
                                <p>区域ID：</p>
                                <input type="text" name="areaId"/>
                            </li>
                            <li>
                                <p>1计划内2计划外：</p>
                                <select name="isPlan" th:with="type=${@dict.getType('')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>是否审核 0未审核1通过2未通过：</p>
                                <select name="isCheck" th:with="type=${@dict.getType('')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>审核人：</p>
                                <input type="text" name="checkUser"/>
                            </li>
                            <li class="select-time">
                                <p>审核时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCheckTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCheckTime]"/>
                            </li>
                            <li>
                                <p>栏目类型：</p>
                                <select name="columntype" th:with="type=${@dict.getType('')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:task:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:task:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:task:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:task:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:task:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:task:remove')}]];
        var prefix = ctx + "system/task";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "系统 - 任务主体",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'null',
                    visible: false
                },
                {
                    field : 'title', 
                    title : '任务名称'
                },
                /*{
                    field : 'img', 
                    title : '图片'
                },*/
               /* {
                    field : 'content', 
                    title : '内容'
                },*/
                    {
                        field : 'columntype',
                        title : '栏目类型',
                        formatter: function(value, row, index) {
                            if (row.columntype != null){
                                if (row.columntype == 0){
                                    return row.columntype = "健身体育";
                                } else if (row.columntype == 1){
                                    return row.columntype = "理论宣讲";
                                }else if (row.columntype == 2){
                                    return row.columntype = "教育实践";
                                }else if (row.columntype == 3){
                                    return row.columntype = "文化服务";
                                }else if (row.columntype == 4){
                                    return row.columntype = "科技科普";
                                }
                            }else {
                                return row.columntype = "";
                            }
                        }
                    },
                {
                    field : 'finishTime', 
                    title : '完成时间'
                },
               /* {
                    field : 'addtime', 
                    title : '添加时间'
                },
                {
                    field : 'finishRate', 
                    title : '完成率'
                },
                {
                    field : 'isPublish', 
                    title : '0未发布，1已发布'
                },
                {
                    field : 'publishTime', 
                    title : '发布时间'
                },
                {
                    field : 'addId', 
                    title : '发布人ID'
                },*/
                /*{
                    field : 'areaId', 
                    title : '区域ID'
                },*/
                {
                    field : 'isAppoint', 
                    title : '是否指派 0未指派，1已指派',
                    visible: false
                },
               /* {
                    field : 'isPlan', 
                    title : '1计划内2计划外'
                },
                {
                    field : 'isCheck', 
                    title : '是否审核 0未审核1通过2未通过'
                },
                {
                    field : 'checkUser', 
                    title : '审核人'
                },
                {
                    field : 'checkTime', 
                    title : '审核时间'
                },*/
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');

                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="assign(\'' + row.id + '\')"><i class="fa fa-edit"></i>指派</a>');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function assign(id) {
            var url = prefix +"/assign/"+id;
            $.modal.open("添加子级团体",url,'900','600');//900页面宽度  600页面高度
        }
    </script>
</body>
</html>